\(\int x (a+b \log (c x^n))^2 \, dx\) [52]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 14, antiderivative size = 52 \[ \int x \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {1}{4} b^2 n^2 x^2-\frac {1}{2} b n x^2 \left (a+b \log \left (c x^n\right )\right )+\frac {1}{2} x^2 \left (a+b \log \left (c x^n\right )\right )^2 \]

[Out]

1/4*b^2*n^2*x^2-1/2*b*n*x^2*(a+b*ln(c*x^n))+1/2*x^2*(a+b*ln(c*x^n))^2

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {2342, 2341} \[ \int x \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {1}{2} x^2 \left (a+b \log \left (c x^n\right )\right )^2-\frac {1}{2} b n x^2 \left (a+b \log \left (c x^n\right )\right )+\frac {1}{4} b^2 n^2 x^2 \]

[In]

Int[x*(a + b*Log[c*x^n])^2,x]

[Out]

(b^2*n^2*x^2)/4 - (b*n*x^2*(a + b*Log[c*x^n]))/2 + (x^2*(a + b*Log[c*x^n])^2)/2

Rule 2341

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((d_.)*(x_))^(m_.), x_Symbol] :> Simp[(d*x)^(m + 1)*((a + b*Log[c*x^
n])/(d*(m + 1))), x] - Simp[b*n*((d*x)^(m + 1)/(d*(m + 1)^2)), x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[m, -1
]

Rule 2342

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((d_.)*(x_))^(m_.), x_Symbol] :> Simp[(d*x)^(m + 1)*((a + b*Lo
g[c*x^n])^p/(d*(m + 1))), x] - Dist[b*n*(p/(m + 1)), Int[(d*x)^m*(a + b*Log[c*x^n])^(p - 1), x], x] /; FreeQ[{
a, b, c, d, m, n}, x] && NeQ[m, -1] && GtQ[p, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {1}{2} x^2 \left (a+b \log \left (c x^n\right )\right )^2-(b n) \int x \left (a+b \log \left (c x^n\right )\right ) \, dx \\ & = \frac {1}{4} b^2 n^2 x^2-\frac {1}{2} b n x^2 \left (a+b \log \left (c x^n\right )\right )+\frac {1}{2} x^2 \left (a+b \log \left (c x^n\right )\right )^2 \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 41, normalized size of antiderivative = 0.79 \[ \int x \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {1}{4} x^2 \left (b n \left (-2 a+b n-2 b \log \left (c x^n\right )\right )+2 \left (a+b \log \left (c x^n\right )\right )^2\right ) \]

[In]

Integrate[x*(a + b*Log[c*x^n])^2,x]

[Out]

(x^2*(b*n*(-2*a + b*n - 2*b*Log[c*x^n]) + 2*(a + b*Log[c*x^n])^2))/4

Maple [A] (verified)

Time = 0.10 (sec) , antiderivative size = 72, normalized size of antiderivative = 1.38

method result size
parallelrisch \(\frac {x^{2} b^{2} \ln \left (c \,x^{n}\right )^{2}}{2}-\frac {\ln \left (c \,x^{n}\right ) x^{2} b^{2} n}{2}+\frac {b^{2} n^{2} x^{2}}{4}+x^{2} a b \ln \left (c \,x^{n}\right )-\frac {a b n \,x^{2}}{2}+\frac {x^{2} a^{2}}{2}\) \(72\)
risch \(\frac {b^{2} x^{2} \ln \left (x^{n}\right )^{2}}{2}+\frac {b \,x^{2} \left (-i b \pi \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )+i b \pi \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}+i b \pi \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}-i b \pi \operatorname {csgn}\left (i c \,x^{n}\right )^{3}+2 b \ln \left (c \right )-b n +2 a \right ) \ln \left (x^{n}\right )}{2}+\frac {x^{2} \left (4 a^{2}+2 i \pi \,b^{2} n \operatorname {csgn}\left (i c \,x^{n}\right )^{3}+2 \pi ^{2} b^{2} \operatorname {csgn}\left (i c \right )^{2} \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{3}-4 i \ln \left (c \right ) \pi \,b^{2} \operatorname {csgn}\left (i c \,x^{n}\right )^{3}-4 i \pi a b \operatorname {csgn}\left (i c \,x^{n}\right )^{3}-\pi ^{2} b^{2} \operatorname {csgn}\left (i c \right )^{2} \operatorname {csgn}\left (i x^{n}\right )^{2} \operatorname {csgn}\left (i c \,x^{n}\right )^{2}+2 i \pi \,b^{2} n \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )-4 i \ln \left (c \right ) \pi \,b^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )-4 i \pi a b \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )+2 \pi ^{2} b^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right )^{2} \operatorname {csgn}\left (i c \,x^{n}\right )^{3}-4 \pi ^{2} b^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{4}+2 \pi ^{2} b^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{5}-\pi ^{2} b^{2} \operatorname {csgn}\left (i x^{n}\right )^{2} \operatorname {csgn}\left (i c \,x^{n}\right )^{4}+2 \pi ^{2} b^{2} \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{5}-\pi ^{2} b^{2} \operatorname {csgn}\left (i c \right )^{2} \operatorname {csgn}\left (i c \,x^{n}\right )^{4}+2 b^{2} n^{2}+8 \ln \left (c \right ) a b +4 \ln \left (c \right )^{2} b^{2}-4 b^{2} \ln \left (c \right ) n -4 a b n -\pi ^{2} b^{2} \operatorname {csgn}\left (i c \,x^{n}\right )^{6}+4 i \pi a b \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}+4 i \pi a b \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}-2 i \pi \,b^{2} n \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}+4 i \ln \left (c \right ) \pi \,b^{2} \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}-2 i \pi \,b^{2} n \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}+4 i \ln \left (c \right ) \pi \,b^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}\right )}{8}\) \(692\)

[In]

int(x*(a+b*ln(c*x^n))^2,x,method=_RETURNVERBOSE)

[Out]

1/2*x^2*b^2*ln(c*x^n)^2-1/2*ln(c*x^n)*x^2*b^2*n+1/4*b^2*n^2*x^2+x^2*a*b*ln(c*x^n)-1/2*a*b*n*x^2+1/2*x^2*a^2

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 102 vs. \(2 (46) = 92\).

Time = 0.31 (sec) , antiderivative size = 102, normalized size of antiderivative = 1.96 \[ \int x \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {1}{2} \, b^{2} n^{2} x^{2} \log \left (x\right )^{2} + \frac {1}{2} \, b^{2} x^{2} \log \left (c\right )^{2} - \frac {1}{2} \, {\left (b^{2} n - 2 \, a b\right )} x^{2} \log \left (c\right ) + \frac {1}{4} \, {\left (b^{2} n^{2} - 2 \, a b n + 2 \, a^{2}\right )} x^{2} + \frac {1}{2} \, {\left (2 \, b^{2} n x^{2} \log \left (c\right ) - {\left (b^{2} n^{2} - 2 \, a b n\right )} x^{2}\right )} \log \left (x\right ) \]

[In]

integrate(x*(a+b*log(c*x^n))^2,x, algorithm="fricas")

[Out]

1/2*b^2*n^2*x^2*log(x)^2 + 1/2*b^2*x^2*log(c)^2 - 1/2*(b^2*n - 2*a*b)*x^2*log(c) + 1/4*(b^2*n^2 - 2*a*b*n + 2*
a^2)*x^2 + 1/2*(2*b^2*n*x^2*log(c) - (b^2*n^2 - 2*a*b*n)*x^2)*log(x)

Sympy [A] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 76, normalized size of antiderivative = 1.46 \[ \int x \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {a^{2} x^{2}}{2} - \frac {a b n x^{2}}{2} + a b x^{2} \log {\left (c x^{n} \right )} + \frac {b^{2} n^{2} x^{2}}{4} - \frac {b^{2} n x^{2} \log {\left (c x^{n} \right )}}{2} + \frac {b^{2} x^{2} \log {\left (c x^{n} \right )}^{2}}{2} \]

[In]

integrate(x*(a+b*ln(c*x**n))**2,x)

[Out]

a**2*x**2/2 - a*b*n*x**2/2 + a*b*x**2*log(c*x**n) + b**2*n**2*x**2/4 - b**2*n*x**2*log(c*x**n)/2 + b**2*x**2*l
og(c*x**n)**2/2

Maxima [A] (verification not implemented)

none

Time = 0.19 (sec) , antiderivative size = 70, normalized size of antiderivative = 1.35 \[ \int x \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {1}{2} \, b^{2} x^{2} \log \left (c x^{n}\right )^{2} - \frac {1}{2} \, a b n x^{2} + a b x^{2} \log \left (c x^{n}\right ) + \frac {1}{2} \, a^{2} x^{2} + \frac {1}{4} \, {\left (n^{2} x^{2} - 2 \, n x^{2} \log \left (c x^{n}\right )\right )} b^{2} \]

[In]

integrate(x*(a+b*log(c*x^n))^2,x, algorithm="maxima")

[Out]

1/2*b^2*x^2*log(c*x^n)^2 - 1/2*a*b*n*x^2 + a*b*x^2*log(c*x^n) + 1/2*a^2*x^2 + 1/4*(n^2*x^2 - 2*n*x^2*log(c*x^n
))*b^2

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 108 vs. \(2 (46) = 92\).

Time = 0.34 (sec) , antiderivative size = 108, normalized size of antiderivative = 2.08 \[ \int x \left (a+b \log \left (c x^n\right )\right )^2 \, dx=\frac {1}{2} \, b^{2} n^{2} x^{2} \log \left (x\right )^{2} - \frac {1}{2} \, b^{2} n^{2} x^{2} \log \left (x\right ) + b^{2} n x^{2} \log \left (c\right ) \log \left (x\right ) + \frac {1}{4} \, b^{2} n^{2} x^{2} - \frac {1}{2} \, b^{2} n x^{2} \log \left (c\right ) + \frac {1}{2} \, b^{2} x^{2} \log \left (c\right )^{2} + a b n x^{2} \log \left (x\right ) - \frac {1}{2} \, a b n x^{2} + a b x^{2} \log \left (c\right ) + \frac {1}{2} \, a^{2} x^{2} \]

[In]

integrate(x*(a+b*log(c*x^n))^2,x, algorithm="giac")

[Out]

1/2*b^2*n^2*x^2*log(x)^2 - 1/2*b^2*n^2*x^2*log(x) + b^2*n*x^2*log(c)*log(x) + 1/4*b^2*n^2*x^2 - 1/2*b^2*n*x^2*
log(c) + 1/2*b^2*x^2*log(c)^2 + a*b*n*x^2*log(x) - 1/2*a*b*n*x^2 + a*b*x^2*log(c) + 1/2*a^2*x^2

Mupad [B] (verification not implemented)

Time = 0.30 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.15 \[ \int x \left (a+b \log \left (c x^n\right )\right )^2 \, dx=x^2\,\left (\frac {a^2}{2}-\frac {a\,b\,n}{2}+\frac {b^2\,n^2}{4}\right )+x^2\,\ln \left (c\,x^n\right )\,\left (a\,b-\frac {b^2\,n}{2}\right )+\frac {b^2\,x^2\,{\ln \left (c\,x^n\right )}^2}{2} \]

[In]

int(x*(a + b*log(c*x^n))^2,x)

[Out]

x^2*(a^2/2 + (b^2*n^2)/4 - (a*b*n)/2) + x^2*log(c*x^n)*(a*b - (b^2*n)/2) + (b^2*x^2*log(c*x^n)^2)/2